
#pragma once

class MsgSn;
class IMemHandler
{
public:
	virtual~IMemHandler(){};
	virtual void operator()(MsgSn* sn )		= 0;
	virtual void execute(MsgSn* sn )		= 0;
};

template<typename T>
class MemHandler: public IMemHandler
{
	typedef void ( T::* Function )( MsgSn* sn );
public:
	MemHandler( T* obj , Function func )
	{ 
		m_object = obj;
		m_handler = func;
	};

	void operator()( MsgSn* sn )
	{
		(m_object->*m_handler )( sn) ;
	}

	void execute(MsgSn* sn)
	{
		(m_object->*m_handler )( sn) ;
	}
private:
	T *			m_object;
	Function	m_handler;
};
